﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LanguageConfigurationSolution
{
    /// <summary>
    /// This is a control with which it's possible to inject a Html-Encoded value without decoration-tags
    /// </summary>
    public class LanguageEncodedLiteral : Literal
    {

        private string _Key;
        private string _ConfigurationListName;

        public LanguageEncodedLiteral()
            : base()
        {
            this.Mode = LiteralMode.Encode;
        }

        private void Update()
        {
            EnsureChildControls();
            this.Text = ConfigurationReader.GetConfigurationValue(Key, ConfigurationlistName, "");
        }

        public string Key
        {
            get
            {
                return _Key;
            }
            set
            {
                _Key = value;
                Update();
            }
        }

        public string ConfigurationlistName
        {
            get
            {
                return _ConfigurationListName;
            }
            set
            {
                _ConfigurationListName = value;
                Update();
            }
        }

    }
}
